package cz.cvut.fit.bugtrac.manager;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cz.cvut.fit.bugtrac.dao.GraphDAO;
import cz.cvut.fit.bugtrac.exception.BugTracException;
import cz.cvut.fit.bugtrac.publicmodel.dto.graph.GraphDTO;
import cz.cvut.fit.bugtrac.publicmodel.dto.snapshot.SnapshotsDTO;
import cz.cvut.fit.bugtrac.util.DozerUtil;

/**
 * 
 * @author Jarec
 * 
 */
@Component
public class SnapshotManagerImpl implements SnapshotManager {

	private GraphDAO graphDAO;
	private DozerUtil dozerUtil;

	@Override
	public SnapshotsDTO getSnapshots() throws BugTracException {
		Collection<GraphDTO> snaphots = graphDAO.getSnapshotsDTO();
		SnapshotsDTO snapshotsDTO = new SnapshotsDTO();
		snapshotsDTO.setSnapshot(snaphots);
		return snapshotsDTO;
	}

	/**
	 * @return the graphDAO
	 */
	public GraphDAO getGraphDAO() {
		return graphDAO;
	}

	/**
	 * @param graphDAO
	 *            the graphDAO to set
	 */
	@Autowired
	public void setGraphDAO(GraphDAO graphDAO) {
		this.graphDAO = graphDAO;
	}

	/**
	 * @return the dozerUtil
	 */
	public DozerUtil getDozerUtil() {
		return dozerUtil;
	}

	/**
	 * @param dozerUtil
	 *            the dozerUtil to set
	 */
	@Autowired
	public void setDozerUtil(DozerUtil dozerUtil) {
		this.dozerUtil = dozerUtil;
	}

}
